# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: SZanko, szanko at protonmail dot com

pkgname=python-shtab
pkgver=1.6.0
pkgrel=2
pkgdesc='Automagic shell tab completion for Python CLI applications'
arch=('any')
url='https://github.com/iterative/shtab'
license=('Apache')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools-scm'
)
checkdepends=(
  'python-pytest'
  'python-pytest-cov'
  'python-pytest-timeout'
)
_commit='68ac16999be08cf5033c601f162020bde4aaf0ad'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENCE
}
